[04/11] crypto: {arm,arm64,mips}/poly1305 - remove redundant non-reduction from emit
authorJason A. Donenfeld <Jason@zx2c4.com>
Mon, 6 Jan 2020 03:40:49 +0000 (22:40 -0500)
committerSalvatore Bonaccorso <carnil@debian.org>
Mon, 30 Mar 2020 21:06:57 +0000 (22:06 +0100)
commit3db44fb1d81edb36c5a8966af371375e07c30ac9
tree2a7f645e43ec6e58873a56d7b59560781c83cc74
parent864518326eb6d703f3071b460039a3adecc296f3
[04/11] crypto: {arm,arm64,mips}/poly1305 - remove redundant non-reduction from emit

Origin: https://git.zx2c4.com/wireguard-linux/commit?id=c6f2230ac4b29716e572b347415573cf0c3f913a
Bug-Debian: https://bugs.debian.org/953569

This appears to be some kind of copy and paste error, and is actually
dead code.

Pre: f = 0 ⇒ (f >> 32) = 0
    f = (f >> 32) + le32_to_cpu(digest[0]);
Post: 0 ≤ f < 2³²
    put_unaligned_le32(f, dst);

Pre: 0 ≤ f < 2³² ⇒ (f >> 32) = 0
    f = (f >> 32) + le32_to_cpu(digest[1]);
Post: 0 ≤ f < 2³²
    put_unaligned_le32(f, dst + 4);

Pre: 0 ≤ f < 2³² ⇒ (f >> 32) = 0
    f = (f >> 32) + le32_to_cpu(digest[2]);
Post: 0 ≤ f < 2³²
    put_unaligned_le32(f, dst + 8);

Pre: 0 ≤ f < 2³² ⇒ (f >> 32) = 0
    f = (f >> 32) + le32_to_cpu(digest[3]);
Post: 0 ≤ f < 2³²
    put_unaligned_le32(f, dst + 12);

Therefore this sequence is redundant. And Andy's code appears to handle
misalignment acceptably.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Tested-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
[bwh: commit 31899908a0d248b030b4464425b86c717e0007d4 upstream]

Gbp-Pq: Topic features/all/wireguard
Gbp-Pq: Name 0004-crypto-arm-arm64-mips-poly1305-remove-redundant-non-.patch
arch/arm/crypto/poly1305-glue.c
arch/arm64/crypto/poly1305-glue.c
arch/mips/crypto/poly1305-glue.c